﻿@{
    if (Model != null && Model!.PageInfoVM != null && Model!.PageInfoVM.TotalPage > 1)
    {
        <nav aria-label="Page navigation" style="padding-left: 20px;">
            <ul class="pagination" style="margin-bottom: 0rem;">
                @if (Model!.PageInfoVM.CurrentPage > 1)
                {
                    // 首页
                    <li class="page-item">
                        <a class="page-link" aria-label="Head" asp-action="@Model!.RouteInfoVM.DestinationAction" asp-route-page="1">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>

                    // 上一页页码
                    <li class="page-item"><a class="page-link" asp-action="@Model!.RouteInfoVM.DestinationAction" asp-route-page="@(@Model!.PageInfoVM.CurrentPage-1)">@(Model!.PageInfoVM.CurrentPage-1)</a></li>
                }

                <li class="page-item active"><a class="page-link" asp-action="@Model!.RouteInfoVM.DestinationAction" asp-route-page="@Model!.PageInfoVM.CurrentPage">@Model!.PageInfoVM.CurrentPage</a></li>

                @if (Model!.PageInfoVM.CurrentPage < Model!.PageInfoVM.TotalPage)
                {
                    // 下一页页码
                    <li class="page-item"><a class="page-link" asp-action="@Model!.RouteInfoVM.DestinationAction" asp-route-page="@(Model!.PageInfoVM.CurrentPage+1)">@(Model!.PageInfoVM.CurrentPage+1)</a></li>


                    // 尾页
                    <li class="page-item">
                        <a class="page-link" aria-label="Tail" asp-action="@Model!.RouteInfoVM.DestinationAction" asp-route-page="@Model!.PageInfoVM.TotalPage">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                }
            </ul>
        </nav>
    }
}